package com.dnui.seven2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnui.seven2.entity.Crowdfunding;
import com.dnui.seven2.entity.Employee;
import com.dnui.seven2.service.CrowdfundingService;
import com.dnui.seven2.mapper.CrowdfundingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengy
 * @description 针对表【crowdfunding】的数据库操作Service实现
 * @createDate 2022-10-16 09:11:17
 */
@Service
public class CrowdfundingServiceImpl extends ServiceImpl<CrowdfundingMapper, Crowdfunding>
        implements CrowdfundingService{

    @Autowired
    CrowdfundingMapper crowdfundingMapper;

    @Override
    public List<Crowdfunding> queryCrowdfundings(Integer currentPageNum, Integer everyPage) {
        Page page=new Page(currentPageNum,everyPage);
        crowdfundingMapper.selectPage(page, null);
        return page.getRecords();
    }


    @Override
    public List<Crowdfunding> selectAll() {
        //构造条件构造器
        LambdaQueryWrapper<Crowdfunding> queryWrapper=new LambdaQueryWrapper();
        List<Crowdfunding> crowdfundings = crowdfundingMapper.selectList(null);
        return crowdfundings;
    }

    @Override
    public void deleteCrowdfunding(Long crowdfundingId) {
        crowdfundingMapper.deleteById(crowdfundingId);
    }

    @Override
    public void updateCrowdfunding(Crowdfunding crowdfunding) {
        crowdfundingMapper.updateById(crowdfunding);
    }
}





